package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BBiddingQy;
import com.ruoyi.system.service.IBBiddingQyService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 投标保函-企业信息Controller
 * 
 * @author ruoyi
 * @date 2024-10-16
 */
@Controller
@RequestMapping("/system/biddingQy")
public class BBiddingQyController extends BaseController
{
    private String prefix = "system/biddingQy";

    @Autowired
    private IBBiddingQyService bBiddingQyService;

    @RequiresPermissions("system:biddingQy:view")
    @GetMapping()
    public String biddingQy()
    {
        return prefix + "/biddingQy";
    }

    /**
     * 查询投标保函-企业信息列表
     */
    @RequiresPermissions("system:biddingQy:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(BBiddingQy bBiddingQy)
    {
        startPage();
        List<BBiddingQy> list = bBiddingQyService.selectBBiddingQyList(bBiddingQy);
        return getDataTable(list);
    }

    /**
     * 导出投标保函-企业信息列表
     */
    @RequiresPermissions("system:biddingQy:export")
    @Log(title = "投标保函-企业信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(BBiddingQy bBiddingQy)
    {
        List<BBiddingQy> list = bBiddingQyService.selectBBiddingQyList(bBiddingQy);
        ExcelUtil<BBiddingQy> util = new ExcelUtil<BBiddingQy>(BBiddingQy.class);
        return util.exportExcel(list, "投标保函-企业信息数据");
    }

    /**
     * 新增投标保函-企业信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存投标保函-企业信息
     */
    @RequiresPermissions("system:biddingQy:add")
    @Log(title = "投标保函-企业信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(BBiddingQy bBiddingQy)
    {
        return toAjax(bBiddingQyService.insertBBiddingQy(bBiddingQy));
    }

    /**
     * 修改投标保函-企业信息
     */
    @RequiresPermissions("system:biddingQy:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        BBiddingQy bBiddingQy = bBiddingQyService.selectBBiddingQyById(id);
        mmap.put("bBiddingQy", bBiddingQy);
        return prefix + "/edit";
    }

    /**
     * 修改保存投标保函-企业信息
     */
    @RequiresPermissions("system:biddingQy:edit")
    @Log(title = "投标保函-企业信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(BBiddingQy bBiddingQy)
    {
        return toAjax(bBiddingQyService.updateBBiddingQy(bBiddingQy));
    }

    /**
     * 删除投标保函-企业信息
     */
    @RequiresPermissions("system:biddingQy:remove")
    @Log(title = "投标保函-企业信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(bBiddingQyService.deleteBBiddingQyByIds(ids));
    }
}
